import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class HelpFrame extends JFrame {

	private HelpPanel panel;
	public static final ImageIcon logo = new ImageIcon("Logo.png");
	private final int windowSize = 700;
	private JLabel title;
	public final Color backgroundColor = new Color(200, 200, 200); 
	
	public HelpFrame() {
		setTitle("Help Menu");
		panel = new HelpPanel();
		add(panel);
		addKeyListener(new HelpMenuListener());
		setSize(windowSize, windowSize);
		setResizable(false);

		title = new JLabel("Help Menu");
		title.setFont(new Font("Arial", Font.BOLD, 35));
		title.setLocation(windowSize/3, 20);
		panel.add(title);
	}

	public class HelpPanel extends JPanel {

		public HelpPanel() {
			super();
			setPreferredSize(new Dimension(windowSize, windowSize));
			setBackground(backgroundColor);
		}

		public void paintComponent(Graphics page) {
			super.paintComponent(page);
			logo.paintIcon(null, page, windowSize/2 - logo.getIconWidth()/2, windowSize/2 - logo.getIconHeight()/2);
			
			page.drawString("		--The User Robot Selection screen allows you to select the four basic skill levels of your robot.", 20, 75);
			page.drawString("		--These skill levels determine the ability of a robot to perform certain tasks.", 20, 95);
			page.drawString("		--The skill levels are between 1 and 100, with 100 being the most profficient a the given skill.", 20, 115);
			page.drawString("		--The total skill level, the sum of all four levels, is at max 250, so choose your skills wisely!", 20, 135);
			page.drawString("		--The color of the panel will change based on the different skills of the robot that you choose.", 20, 155);
			
			page.drawString("In Game Instructions:",20, 195);
			page.drawString("		--Press the start/continue/pause button to start or pause the robot simulation.", 20, 215);
			page.drawString("		--After 2 minutes have expired, the game will end and the program will announce the winner.", 20, 235);
			
		}
	}
		private class HelpMenuListener implements KeyListener {

		//If the escape key is pressed, the window will close
		public void keyPressed(KeyEvent event) {
			if (event.getKeyCode() == KeyEvent.VK_ESCAPE){
				setVisible(false);
			}
		}

		//Overridden methods
		public void keyReleased(KeyEvent event) {}
		public void keyTyped(KeyEvent event) {}
	}
}
